<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org" lang="en">
<head>
    <title th:text="${question.title}"></title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <link rel="stylesheet" href="/css/bootstrap.min.css">
    <link rel="stylesheet" href="/css/bootstrap-theme.min.css">
    <link rel="stylesheet" href="/css/OneCommunity.css">
    <link rel="stylesheet" href="/css/editormd.min.css">
    <link rel="stylesheet" href="/css/editormd.preview.min.css">
    <script src="/js/jquery-3.5.0.min.js"></script>
    <script src="/js/bootbox.min.js" text="application/javascript"></script>
    <script src="/js/bootstrap.min.js"></script>
    <script src="/js/One.js" text="application/javascript"></script>
    <script src="/js/moment.min.js" text="application/javascript"></script>
    <script src="/js/editormd.min.js" text="application/javascript"></script>
    <script src="/js/lib/marked.min.js" text="application/javascript"></script>
    <script src="/js/lib/prettify.min.js" text="application/javascript"></script>

</head>
<body>
<!--导航菜单-->
<div th:insert="navigation::nav"></div>

<div class="container-fluid main profile">
    <div class="row" style="background-color: #ffffff">

        <!--        -->
        <div class="col-lg-9 col-md-12 col-sm-12 col-xs-12">
            <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
                <!--            class="glyphicon glyphicon-list"-->
                <!--                            正文-->
                <h3><span aria-hidden="true" th:text="${question.title}"></span></h3>
                <span class="text-descripte">
        <!--                        快捷键：ctrl +shift +上下键 实现代码的上下移动-->
                                作者：<span th:text="${question.user.name}"></span> &nbsp;| &nbsp;
                                发布时间：<span th:text="${#dates.format(question.gmtCreate,' yyyy-MM-dd HH:mm')}"></span>  &nbsp;| &nbsp;
                                阅读数：<span th:text="${question.viewCount}"></span>
                            </span>
                <hr class="col-lg-12 col-md-12 col-sm-12 col-xs-12"/>

                <!--                内容部分-->
                <div id="question-view" class="col-lg-12 col-md-12 col-sm-12 col-xs-12"
                     style="height: auto;margin-bottom:5px ">
                    <label>
                            <textarea style="display: none;" th:text="${question.description}">
                            </textarea>
                    </label>
                </div>
                <!--                将markdown文本换化为html内容并显示出现-->
                <script type="text/javascript">
                    $(function () {
                        editormd.markdownToHTML("question-view", {});
                    });
                </script>

                <hr class="col-lg-12 col-md-12 col-sm-12 col-xs-12"/>
                <!--                标签-->
                <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
                    <span th:each="tag:${question.tag.split(' ')}">
                        <span class="label label-success tag-list">
                            <span class="glyphicon glyphicon-tags"></span>&nbsp;&nbsp;
                             <span th:text="${tag}"></span>
                        </span>&nbsp;
                    </span>
                </div>
                <hr class="col-lg-12 col-md-12 col-sm-12 col-xs-12"/>
                <!--                编辑-->
                <div th:if="${session.user!=null && session.user.id == question.creator}">
                    <a th:href="@{'/publish/'+${question.id}}" class="community-menu"
                       style="position: relative;left: 80%;text-decoration:none;">
                        <span class="glyphicon glyphicon-pencil" aria-hidden="true"></span>编辑

                    </a>
                    <!--                            点赞数-->
                    <span th:data-question-like="${question.id}" onclick="collapseQuestionLike(this)" class="community-menu" style="position: relative;left: 82%;">
                                <span class="icon">
                                        <span class="glyphicon glyphicon-thumbs-up "></span>
                                        <span th:if="${question.likeCount>0}">
                                                  <span th:text="${question.likeCount}"></span>
                                        </span>
                                </span>
                </span>
                </div>

            </div>

            <!--            回复列表-->

            <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
                <div class="media">
                    <h4>
                        <span th:text="${question.commentCount}"></span>个回复
                    </h4>
                </div>
            </div>

            <!--            IDEA 代码格式化的快捷键-->

            <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12" th:each="comment:${comments}">
                <div class="media">
                    <div class="media-left">
                        <img class="media-object img-circle" th:src="${comment.user.avatarUrl}" alt="图片">&nbsp;
                    </div>
                    <div class="media-body" th:id="${'comment-body'+comment.id}">
                        <h5 th:text="${comment.user.name}" style="color: #2aabd2"></h5>
                        <div th:text="${comment.content}"></div>
                        <div class="comment-menu">
                            <!--                            点赞数-->

                            <span th:data-comment-like="${comment.id}" onclick="collapseCommentLike(this)">
                                <span class="icon">
                                        <span class="glyphicon glyphicon-thumbs-up"></span>
                                        <span th:if="${comment.likeCount>0}">
                                                  <span th:text="${comment.likeCount}"></span>
                                        </span>
                                    </span>
                            </span>
                            <!--                                    评论数-->
                            <span style="margin-left: 12px;" class="icon" th:data-id="${comment.id}"
                                  onclick="collapseComments(this)">
                                        <span class="glyphicon glyphicon-comment"></span>
                                    <span th:if="${comment.commentCount>=1}">
                                         <span th:text="${comment.commentCount}"></span>
                                    </span>
                            </span>
                            <span style="position: relative;left: 80%;"
                                  th:text="${#dates.format(comment.gmtCreate,' yyyy-MM-dd')}"></span>

                            <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 collapse comment-bord"
                                 th:id="${'comment-'+comment.id}">
                                <!--                            二级回复-->
                                <!--                                需要改变部分的代码：模板-->

                                <!--
                                <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 comments" th:each="comment:${comments}">
                                        <div class="media">
                                            <div class="media-left">
                                                <img class="media-object img-circle" th:src="${comment.user.avatarUrl}"
                                                     alt="图片">&nbsp;
                                            </div>
                                            <div class="media-body">
                                                <h5 th:text="${comment.user.name}" style="color: #2aabd2"></h5>
                                                <div th:text="${comment.content}"></div>
                                                <span style="position: relative;left: 81.2%;"
                                                      th:text="${#dates.format(comment.gmtCreate,' yyyy-MM-dd')}"></span>
                                            </div>
                                            <hr class="col-lg-12 col-md-12 col-sm-12 col-xs-12 comment-sp">
                                        </div>
                                </div>
                                -->


                                <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
                                    <input type="text" class="form-control" placeholder="评论一下吧"
                                           th:id="${'input-'+comment.id}">
                                    <button type="button" class="btn btn-info request-btn" onclick="comment(this)"
                                            th:data-id="${comment.id}">回复
                                    </button>
                                    <!--                                    <button type="button" class="btn btn-default request-btn"  onclick="close()">取消</button>-->
                                </div>
                                <!--                            -->
                            </div>
                        </div>

                    </div>
                    <hr class="col-lg-12 col-md-12 col-sm-12 col-xs-12 comment-sp">
                </div>
            </div>

            <!--回复输入框-->

            <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12" id="comment_section">
                <div class="media">
                    <div class="media-left media-middle">
                        <img class="media-object img-circle"
                             th:src="${ session.user!= noll ? session.user.avatarUrl : '/images/defaultAvatar.png'}"
                             alt="图片">&nbsp;
                    </div>
                    <div class="media-body">
                        <h5 th:text="${session.user!= noll ? session.user.name :'匿名用户'}" style="color: #2aabd2"></h5>
                    </div>
                </div>
                <input type="hidden" id="input_id" th:value="${question.id}">
                <textarea class="form-control comment" rows="10" id="comment_id"></textarea>
                <button type="button" class="btn btn-success comment-btn" onclick="Post()">评论</button>
            </div>
        </div>

        <!--    右边部分    -->
        <div class="col-lg-3 col-md-12 col-sm-12 col-xs-12">
            <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
                <h3>发起人</h3>
                <div class="media">
                    <div class="media-left media-middle">
                        <a href="#">
                            <!--/*@thymesVar id="user" type=""*/-->
                            <img class="media-object img-circle" th:src="${question.user.avatarUrl}" alt="图片">&nbsp;
                        </a>
                    </div>
                    <div class="media-body">
                        <h5>
                            <a href="#" th:text="${question.user.name}"
                               style="color: #2aabd2;text-decoration: none;"></a>
                        </h5>
                    </div>
                </div>

            </div>
            <hr class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
            <!--            联系方式-->
            <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
                <h3>官微助手</h3>
                <img src="/images/wechatLogo.jpg" alt="图片" style="width: 100px;height: 100px;">
            </div>

            <hr class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
            <!--            相关问题-->
            <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
                <h3>相关发布</h3>
                <ul>
                    <li th:each="related:${relatedQuestions}">
                        <a th:href="@{'/question/'+${related.id}}" th:text="${related.title}" id="related"></a>
                    </li>
                </ul>

            </div>

        </div>
    </div>
</div>
<!--底部备案号-->
<div th:fragment="footer">
    <div id="footer">CopyRight@copyYangmoyu 黔ICP备20003575号-1</div>
</div>

</body>
</html>